package com.cskaoyan.controller;

import com.cskaoyan.module.bean.BaseRespVo;
import com.cskaoyan.module.bean.vo.MallKeywordVO;
import com.cskaoyan.module.pojo.MarketKeyword;
import com.cskaoyan.service.MallKeywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :ligenghuisheng
 * @Description:
 * @Date :2022/4/7  23:13
 */
@RestController
@RequestMapping("admin/keyword")
public class MallKeywordController {

    @Autowired
    MallKeywordService mallKeywordService;
    //展示关键词首页
    @RequestMapping("list")
    public BaseRespVo listKeyword(MallKeywordVO mallKeywordVO){
        MallKeywordVO marketKeyword1 = mallKeywordService.list(mallKeywordVO);


        return BaseRespVo.ok(marketKeyword1);
    }
    //新增关键词
    @PostMapping("create")
    public BaseRespVo createKeyword(@RequestBody MarketKeyword marketKeyword){
       MarketKeyword marketKeyword1 = mallKeywordService.create(marketKeyword);

        return BaseRespVo.ok(marketKeyword1);
    }
    //编辑关键词
    @PostMapping("update")
    public BaseRespVo updateKeywod(@RequestBody MarketKeyword marketKeyword){
        MarketKeyword marketKeyword1 = mallKeywordService.update(marketKeyword);

        return BaseRespVo.ok(marketKeyword1);
    }
    //删除关键词
    @PostMapping("delete")
    public BaseRespVo deleteKeword(@RequestBody MarketKeyword marketKeyword){
         mallKeywordService.delete(marketKeyword);
        return BaseRespVo.ok("成功");

    }
}
